package com.jqr.activity.myroomcart.viewmodels;

import android.app.Application;
import android.content.Context;
import android.content.Intent;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.MutableLiveData;


public class MainViewModel extends AndroidViewModel {

    private MutableLiveData<String>  name;
    private Context context;
    public MainViewModel(@NonNull Application application) {
        super(application);
        context=application;
    }

    public MutableLiveData<String> getName() {
        if(name==null){

            name=new MutableLiveData<>();
            name.setValue("Hello Jakpack Compose");
        }
        return  name;
    }

    public void callPhone(){
        Intent intent=new Intent();
        intent.setAction(Intent.ACTION_CALL);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        context.startActivity(intent);
    }
}
